package com.toommi.refuse.common.enums;

/**
 * ..
 * 可回收垃圾分类类型
 *
 * @author yangg
 * @since 2019-08-01 09:49
 */
public enum RecyclableTrashTypeEnum {

    /**
     * 可回收垃圾
     */

    PAPER(20, "paper", "纸类"),
    cardboard(21, "cardboard", "黄纸板"),
    wrapping (22, "wrapping", "其它包装纸"),
    Office(23, "Office", "办公用纸"),
    Newspaper(24, "Newspaper", "报纸"),
    Miscellaneous(25, "Miscellaneous", "杂纸"),

    PLASTIC(12, "plastic", "塑料"),
    Transparent(26, "Transparent", "透明塑料"),
    White(27, "White", "白色塑料"),
    Otherplastics(28, "Otherplastics", "其它塑料"),

    METAL(18, "metal", "金属"),
    Iron(29, "Iron", "铁制品"),
    Stainless(30, "Stainless", "不锈钢制品"),
    Aluminum(31, "Aluminum", "铝制品"),
    Copper(32, "Copper", "铜制品"),
    GLASS(14, "glass", "玻璃"),

    TEXTILE(19, "textile", "织物"),
    Summer(33, "Summer", "夏装"),
    Winter(34, "Winter", "冬装"),
    footwear(35, "footwear", "鞋类"),
    Packet(36, "Packet", "包类")
    ;

    private long id;

    public long getId() {
        return id;
    }

    RecyclableTrashTypeEnum(long id, String code, String note) {
        this.id = id;
        this.code = code;
        this.note = note;
    }

    private String code;

    private String note;

    public String getCode() {
        return code;
    }

    public String getNote() {
        return note;
    }

    RecyclableTrashTypeEnum(String code, String note) {
        this.code = code;
        this.note = note;
    }

    /**
     * 校验值是否存在枚举范围内
     *
     * @param id 被校验值
     * @return 是否存在
     */
    public static boolean hasValue(long id) {
        for (RecyclableTrashTypeEnum typeEnum : RecyclableTrashTypeEnum.values()) {
            if (typeEnum.getId() == id) {
                return true;
            }
        }
        return false;
    }

    public static RecyclableTrashTypeEnum getType(long id) {
        for (RecyclableTrashTypeEnum typeEnum : RecyclableTrashTypeEnum.values()) {
            if (typeEnum.getId() == id) {
                return typeEnum;
            }
        }
        return null;
    }

}
